package com.lyy.mapper;

import com.lyy.entity.Order;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;

/**
 * @author Liangyaoyun
 */
@Mapper

public interface OrderMapper {

    /**
     * 下单购买商品
     *
     * @param order 订单实体
     * @return 影响条目数
     */
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into `order` (id, sn, product_id, number) " +
            "values (#{id}, #{sn}, #{productId}, #{number})")
    int insert(Order order);
}

